package com.oneguy.download;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.oneguy.libupdate.DownloadActivity;
import com.oneguy.update.R;

import java.io.File;

/**
 * Created by ZuoShu on 17/1/12.
 */
public class TestActivity extends Activity {
    private static final String TAG = "TestActivity";
    private static final int ONE_MB = 1024 * 1024;

    EditText pathText;
    Button start;

    private static final String path = "https://download.0354yx.com/appgame/huapai_7.3.3.0.apk";
    private File saveDir = Environment.getExternalStorageDirectory();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.acitivity_test);
        pathText = (EditText) findViewById(R.id.path);
        pathText.setText(path);
        start = (Button) findViewById(R.id.start);

        start.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                start(pathText.getText().toString());
            }
        });
    }

    private void start(String url) {
        Intent intent = new Intent();
        intent.putExtra("url", url);
        intent.setClass(this, DownloadActivity.class);
        startActivity(intent);
        overridePendingTransition(0, 0);
    }

}
